package db

import (
	"context"
	"github.com/jackc/pgx/v5/pgxpool"
)

// GetDBConn 取数据库连接
func GetDBConn() (*pgxpool.Conn, error) {
	// 从连接池中获取一个单独的连接
	conn, err := dbPool.Acquire(context.Background())
	if err != nil {
		logger.Errorf("get db connection failed: %v", err)
		return nil, err
	}

	return conn, nil
}
